package com.test.demo;

/**
 * ${DESCRIPTION}
 *
 * @author muxiaoyu
 * @create 2017/05/15 9:58
 **/
public class CourseFactory {
    public static Course getCourseByName(String name) {
        if ("English".equals(name)) {
            return new English();
        } else if ("Chiness".equals(name)) {
            return new Chiness();
        }
        return null;
    }

    public static void main(String[] args) {
        Course english = CourseFactory.getCourseByName("Chiness");
        english.printCourseName();
    }
}